# -*- coding:utf-8 -*-

# @Time    : 2018/9/27 4:13 PM

# @Author  : Swing


import pandas as pd

df = pd.DataFrame([
    ['1', '1', 10.1, '1'],
    ['2', '2', 13.5, '0'],
    ['3', '3', 15.3, '1']])

df.columns = ['color', 'size', 'prize', 'class label']

# size_mapping = {
#     'XL': 3,
#     'L': 2,
#     'M': 1}
# df['size'] = df['size'].map(size_mapping)
#
# class_mapping = {label: idx for idx, label in enumerate(set(df['class label']))}
# df['class label'] = df['class label'].map(class_mapping)
train = pd.get_dummies(df)
